<?php
/*
Template Name: Tuan
*/
get_header();
?>


<div class='vongchungket_side'>
                        <div class='side_content'>
                            <img src='<?php echo get_template_directory_uri()?>/img/header_vongchungket.png' class='title' alt=''/>
                            
                            <div class='vongchungket_info'>
                                
<?php 

$cat=get_category_by_slug('giainhat');
$args = array(
					 		'showposts'=>-1,
					 		'category__in'=>array($cat->cat_ID),
							'orderby' => 'id',
							'order' => 'DESC',
							
						);						
					
					//$searchname=sanitize_title($searchq);
					//$arrposturl=array();
					$postgiainhat= query_posts($args);	
					$notfound=true;
					while(have_posts()){ the_post();
						$fullname=get_post_meta($post->ID,'fullname',1);
						$songname=get_post_meta($post->ID,'songname',1);
                                $notfound=false;
									?>	
		
                                  <!-- GIAI NHAT  -->
                                <div class='giaithuong_content'>
                                    <div class='giaithuong_subtitle_content'>
                                        <!-- <img src='img/giainhat_subtitle.png'/> -->
                                        <div class='giaithuong_subtitle'>Giải nhất </div>
                                    </div>
                                    <div class='giaithuong_detail'>
                                        <div class='videogiaithuong_img float_left' >
                                            <a href='<?php the_permalink()?>'>
                                            <?php echo the_post_thumbnail('medium',array('style'=>'','title'=>get_the_title(),'alt'=>get_the_title(),'class'=>'video_thumbnail') );?>
                                                
                                            </a>
                                        </div>
                                        <div class='thongtinthisinh float_left'>
                                           Thí sinh: <?php echo $fullname?><br/>
                                            Tên bài hát: <?php echo $songname?>
                                        </div>
                                        <div class='float_right'style='position:absolute;right:0;padding-top:15px'>
                                            <img src='<?php echo get_template_directory_uri()?>/img/giaithuong1.png' alt=''/>
                                        </div>

                                    </div>
                                </div>

                                <div class='clear'></div>
                                    
                                   
                                    <?php }
                                    
                    $cat=get_category_by_slug('giaiphongcachtrinhdien');
					$args = array('category__in'=>array($cat->cat_ID));
					$postgiaiphongcachtrinhdien= query_posts($args);
					while(have_posts()){ the_post();
						$fullname=get_post_meta($post->ID,'fullname',1);
						$songname=get_post_meta($post->ID,'songname',1);
                                $notfound=false;
                                    ?> 
                                    <!-- GIAI PHONG CACH TRINH DIEN   -->

                                <div class='giaithuong_content'>
                                    <div class='giaithuong_subtitle_content'>
                                        <!-- <img src='img/giaitrienvong_subtitle.png'/> -->
                                        <div class='giaithuong_subtitle'>Giải phong cách trình diễn </div>
                                    </div>
                                    <div class='giaithuong_detail'>
                                        <div class='videogiaithuong_img float_left' >
                                            <a href='<?php the_permalink()?>'>
                                                <?php echo the_post_thumbnail('medium',array('style'=>'','title'=>get_the_title(),'alt'=>get_the_title(),'class'=>'video_thumbnail') );?>
                                            </a>
                                        </div>
                                        <div class='thongtinthisinh float_left'>
                                            Thí sinh: <?php echo $fullname?><br/>
                                            Tên bài hát: <?php echo $songname?>
                                        </div>
                                        <div class='float_right'style='position:absolute;right:0;padding-top:15px'>
                                            <img src='<?php echo get_template_directory_uri()?>/img/giaiphongcachtrinhdien.png' alt=''/>
                                        </div>
                                    </div>
                                </div>  

                                <div class='clear'></div>
                                    <?php }
                                    
                    $cat=get_category_by_slug('giaibigcphongcachkool');
					$args = array('category__in'=>array($cat->cat_ID));
					$postgiaikhangiayeuthichnhat= query_posts($args);
					while(have_posts()){ the_post();
						$fullname=get_post_meta($post->ID,'fullname',1);
						$songname=get_post_meta($post->ID,'songname',1);
                                $notfound=false;
                                    ?> 
                                     <!-- GIAI BIG C PHONG CACH KOOL   -->

                                <div class='giaithuong_content'>
                                    <div class='giaithuong_subtitle_content'>
                                        <!-- <img src='img/giaitrienvong_subtitle.png'/> -->
                                        <div class='giaithuong_subtitle'>Giải Big C phong cách Kool  </div>
                                    </div>
                                    <div class='giaithuong_detail'>
                                        <div class='videogiaithuong_img float_left' >
                                            <a href='<?php the_permalink()?>'>
                                                <?php echo the_post_thumbnail('medium',array('style'=>'','title'=>get_the_title(),'alt'=>get_the_title(),'class'=>'video_thumbnail') );?>
                                            </a>
                                        </div>
                                        <div class='thongtinthisinh float_left'>
                                           Thí sinh: <?php echo $fullname?><br/>
                                            Tên bài hát: <?php echo $songname?>
                                        </div>
                                        <div class='float_right'style='position:absolute;right:0;padding-top:15px'>
                                            <img src='<?php echo get_template_directory_uri()?>/img/giaibigphongcachkool.png' alt=''/>
                                        </div>
                                    </div>
                                </div>  

                                <div class='clear'></div>
                                    <?php }
                                    
                    $cat=get_category_by_slug('giaigionghattrienvong');
					$args = array('category__in'=>array($cat->cat_ID));
					$postgiaigionghattrienvong= query_posts($args);
					while(have_posts()){ the_post();
						$fullname=get_post_meta($post->ID,'fullname',1);
						$songname=get_post_meta($post->ID,'songname',1);
                                $notfound=false;
                                    ?> 
                                     <!-- GIAI TRIEN VONG   -->

                                <div class='giaithuong_content'>
                                    <div class='giaithuong_subtitle_content'>
                                        <!-- <img src='img/giaitrienvong_subtitle.png'/> -->
                                        <div class='giaithuong_subtitle'>Giải giọng hát triển vọng </div>
                                    </div>
                                    <div class='giaithuong_detail'>
                                        <div class='videogiaithuong_img float_left' >
                                            <a href='<?php the_permalink()?>'>
                                                <?php echo the_post_thumbnail('medium',array('style'=>'','title'=>get_the_title(),'alt'=>get_the_title(),'class'=>'video_thumbnail') );?>
                                            </a>
                                        </div>
                                        <div class='thongtinthisinh float_left'>
                                            Thí sinh: <?php echo $fullname?><br/>
                                            Tên bài hát: <?php echo $songname?>
                                        </div>
                                        <div class='float_right'style='position:absolute;right:0;padding-top:15px'>
                                            <img src='<?php echo get_template_directory_uri()?>/img/giaithuongtrienvong.png' alt=''/>
                                        </div>
                                    </div>
                                </div>  

                                <div class='clear'></div>
                                    <?php }
                                    
                    $cat=get_category_by_slug('giaikhangiayeuthichnhat');
					$args = array('category__in'=>array($cat->cat_ID));
					$postgiaibigcphongcachkool= query_posts($args);
					while(have_posts()){ the_post();
						$fullname=get_post_meta($post->ID,'fullname',1);
						$songname=get_post_meta($post->ID,'songname',1);
                                $notfound=false;
                                    ?> 
					 <!-- GIAI KHAN GIA YEU THICH NHAT   -->

                                <div class='giaithuong_content'>
                                    <div class='giaithuong_subtitle_content'>
                                        <!-- <img src='img/giaitrienvong_subtitle.png'/> -->
                                        <div class='giaithuong_subtitle'>Giải khán giả yêu thích nhất</div>
                                    </div>
                                    <div class='giaithuong_detail'>
                                        <div class='videogiaithuong_img float_left' >
                                            <a href='<?php the_permalink()?>'>
                                                <?php echo the_post_thumbnail('medium',array('style'=>'','title'=>get_the_title(),'alt'=>get_the_title(),'class'=>'video_thumbnail') );?>
                                            </a>
                                        </div>
                                        <div class='thongtinthisinh float_left'>
                                            Thí sinh: <?php echo $fullname?><br/>
                                            Tên bài hát: <?php echo $songname?>
                                        </div>
                                        <div class='float_right'style='position:absolute;right:0;padding-top:15px'>
                                            <img src='<?php echo get_template_directory_uri()?>/img/giaikhangiayeuthich.png' alt=''/>
                                        </div>
                                    </div>
                                </div>  
                                <div class='clear'></div>
					
					<?php 
					}
					if($notfound){
					?>
                                    		<div class='vongbanket_detail'>
			                                    <img src='<?php echo get_template_directory_uri()?>/img/vongchungket_info.png' alt=''/>
			                                </div>
                                    		<?php
                                    }
                                    ?>
                                    
                                
                            </div>
                           
                        </div>

                    </div>


	<script>
	
    (function($){
        $(window).load(function(){
        	$(".vongchungket_info").mCustomScrollbar();
            // $("#video_content").mCustomScrollbar({
            //     horizontalScroll:true,
            //     theme:"light",
            //     scrollButtons:{
            //         enable:true
            //     }
            // });
            
        });        
        
    })(jQuery);    

    $(document).on("facebook:ready", function(){
        <?php 
        //get count for video
        if(count($arrposturl)>0){
        	foreach($arrposturl as $k=>$v){
        		?>
        		var url<?php echo $k?>="<?php echo $v?>";
        		url<?php echo $k?>='/'+url<?php echo $k?>.replace(apppath,'')+'/';
        		$.getJSON("https://api.facebook.com/method/fql.query?query=select total_count,like_count,comment_count,share_count,click_count from link_stat where url='"+fbplugin.appurl+url<?php echo $k?>+"'&format=json",
				    	 function(data) {	
								console.log(url<?php echo $k?>);
								console.log(data);
			    	 			if(data[0]!=undefined && data[0]['like_count'] !=undefined){
				    	 			$('#like<?php echo $k?>').html(data[0]['like_count']);				    	 			
				    	 			//fbplugin.likeCount=data[0]['like_count'];			    	 				
			    	 			}			    	 			
			    });
        		<?php 
        	}	
        }
        ?>
    });
</script>


<?php get_footer(); ?>